using UnityEngine;
using System.Collections;

public class GridSize {
	
	public int X;
	public int Y;
	
	static readonly GridSize zero = new GridSize(0,0);
	
	public GridSize(int lengthX, int lengthY)
	{
		this.X = lengthX;
		this.Y = lengthY;
	}
	
	static public GridSize Zero
	{
		get{return zero;}	
	}
	
	public int TotalSize
	{
		get{return (X * Y);}
	}
	
	public static GridSize operator -(GridSize a, GridSize b)
	{
		return new GridSize(a.X - b.X, a.Y - b.Y);
	}
	
	public static GridSize operator +(GridSize a, GridSize b)
	{
		return new GridSize(a.X + b.X, a.Y + b.Y);
	}
	
	public static bool operator ==(GridSize a, GridSize b)
	{
		return (a.X == b.X && a.Y == b.Y);
	}
	
	public static bool operator !=(GridSize a, GridSize b)
	{
		return (a.X != b.X || a.Y != b.Y);
	}
	
	public override int GetHashCode ()
	{
		return base.GetHashCode ();
	}
	
	public override bool Equals (object obj)
	{
		return base.Equals (obj);
	}
	
	public override string ToString ()
	{
		return string.Format ("[GridSize: TotalSize={0} X={1} Y={2}]", TotalSize, X, Y);
	}
}
